package com.qijian.maindata.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qijian.maindata.domain.ExamineScheme;
import com.qijian.maindata.domain.query.ExamineSchemeQuery;
import com.qijian.maindata.domain.vo.ExamineSchemeVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 检验方案Mapper接口
 *
 * @author qijian
 * @date 2021-11-24
 */
public interface ExamineSchemeMapper extends BaseMapper<ExamineScheme> {

    @Select("select count(0)+IF(#{isAddOne},1,0) from main_examine_scheme WHERE create_time >= CURRENT_DATE ")
    int countCurrentDateWithDel(boolean isAddOne);

    @Select("select count(0)+IF(#{isAddOne},1,0) from main_examine_scheme ")
    int countWithDel(boolean isAddOne);

    List<ExamineSchemeVo> getMainAndDetail(Long examineId);

    Page<ExamineSchemeVo> selectPageVo(Page<ExamineSchemeVo> page, @Param(Constants.WRAPPER) QueryWrapper<ExamineSchemeQuery> wrapper);

}
